using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FutureOpen.Web.Pages;
using FreeTextBoxControls;
using FutureOpen.Core.func.sql;

public partial class test_MyBlogUpdate : PageBase
{
    private int topic_id;
    private string title;
    private string content;
    protected void Page_Load(object sender, EventArgs e)
    {
        base.PageInit();
        topic_id = base.artid;

        if (!Page.IsPostBack)
        {
            LoadBlog();
        }
    }

    private void LoadBlog()
    {
        DataRow dr = TopicProvider.GetTopicDetailByID(topic_id);
        object[] array = dr.ItemArray;
        title = array[0].ToString();
        content = array[1].ToString();        
        this.HtmlEditor1.Text = content;
        tbBlogTitle.Text = title;
    }
    protected void btBlodUpdate_Click(object sender, EventArgs e)
    {
        string content = this.HtmlEditor1.Text;
        TopicProvider.ModifyTopic(topic_id, tbBlogTitle.Text,content);
        Response.Redirect("MyBlog.aspx?");
    }
    protected void btBlodPublish_Click(object sender, EventArgs e)
    {
        if (IsLogin())
        {
            string content = this.HtmlEditor1.Text;
            TopicProvider.ModifyTopic(topic_id, tbBlogTitle.Text, content);
            Response.Redirect("MyBlog.aspx?");
        }
        else
        {
            GoBack();
        }

    }
}
